package com.javaweb.admin.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.javaweb.admin.entity.KdlQffAttach;
import com.javaweb.admin.entity.NcTaskLog;
import com.javaweb.admin.entity.Scheduled;
import com.javaweb.admin.mapper.KdlQffAttachMapper;
import com.javaweb.admin.mapper.ScheduledMapper;
import com.javaweb.admin.query.QffFeedbackQuery;
import com.javaweb.admin.service.AbstractJob;
import com.javaweb.admin.service.INcTaskLogService;
import com.javaweb.common.annotation.Log;
import com.javaweb.common.config.CommonConfig;
import com.javaweb.common.enums.LogType;
import com.javaweb.common.enums.OperType;
import com.javaweb.common.utils.DateUtils;
import com.javaweb.common.utils.SFTPUtil;
import com.seegw.shaphar.IKDLService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class SyncKdlCOAJob extends AbstractJob {
    private static final Logger log = LoggerFactory.getLogger(SyncKdlCOAJob.class);
    @Autowired
    ScheduledMapper scheduledMapper;

    @Autowired
    IKDLService kdlService;


    @Autowired
    INcTaskLogService iNcTaskLogService;

    @Autowired
    SFTPUtil ftpUtil;

    @Autowired
    KdlQffAttachMapper kdlQffAttachMapper;


    @Override
    public String getName() {
        QueryWrapper<Scheduled> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("classpath",this.getClass().getName());
        Scheduled entity = scheduledMapper.selectOne(queryWrapper);
        return entity.getName();
    }

    @Override
    @Log(title = "下载药检报告",isSaveRequestData = false,operType = OperType.MANAGE,logType = LogType.UPDATE)
    public void execute() {
        log.info("开始药检报告....");
        kdlService.syncCoaFile();
        log.info("药检报告下载完成完成");

    }
}
